<template>
    <div class="other-box">
      <van-sidebar v-model="activeKey" @change="onChange">
        <van-sidebar-item :title="item" v-for="(item,index) in leftlist" :key="index" />
      </van-sidebar>
      <div class="right-content" >
        <div class="itemdisease" v-for="(item,index) in diseasecontent" :key="index">
            <div class="name">{{item.name}}</div>
            <div class="ismedicalInsurance">是否纳入医保：{{item.medicalInsurance}}</div>
            <div class="scalias">俗称：
              <span v-for="(items,i) in item.alias" :key="i">{{items}}</span>
            </div>
            <div class="infectiousness">传染性：<span>{{item.infectiousness}}</span></div>
            <div>症状：<span class="typicalSymptom">{{item.typicalSymptom}}</span></div>
        </div>

      </div>
    </div>
</template>
<script>
import { Sidebar, SidebarItem } from "vant";
export default {
  components: {
    [Sidebar.name]: Sidebar,
    [SidebarItem.name]: SidebarItem
  },
  data() {
    return {
      activeKey: 0,
      leftlist: [],
      diseasecontent:[]
    };
  },
  mounted() {
    this.queryleftlist();
    this.queryDiseaseListBySite("咽喉")
  },
  methods: {
    onChange(e) {
      //https://api.apishop.net/common/disease/queryDiseaseListBySite?apiKey=您的apiKey&page=参数1&pageSize=参数2&site=参数3
      console.log(e);
      let seleindex = this.leftlist[e];
      this.queryDiseaseListBySite(seleindex)
    },
    async queryleftlist() {//请求左侧菜单
      let res = await this.$axios.post(
        "/api/common/disease/queryDiseaseSiteList",
        {
          apiKey: "Ib3I1727eb283024b369d60868c8f7b3a719354fd552991",
          diseaseID: 41
        }
      );
      if (res.statusCode == "000000") {
        this.leftlist = res.result.siteList;
      }
    },
    async queryDiseaseListBySite(code){ //根据关键字搜索对应症状
        let res = await this.$axios.post(
        "/api/common/disease/queryDiseaseListBySite",
        {
          apiKey: "Ib3I1727eb283024b369d60868c8f7b3a719354fd552991",
          site: code
        }
       );
       if(res.statusCode == "000000"){
         this.diseasecontent =res.result.diseaseList
       }
    }
  }
};
</script>
<style scoped lang="less">
// ::-webkit-scrollbar {
// 	width: 0;
// 	height: 0;
// 	color: transparent;
// }
.other-box {
  position: relative;
  .van-sidebar {
    position: fixed;
    height: 100%;
    overflow: auto;
    float: left;
    top: 0;
    bottom: 3rem;
  }
  .right-content {
    height: 100%;
    position: absolute;
    top: 0;
    left: 80px;
    right: 0;

  }
}
/deep/ .van-sidebar-item--select::before {
  background-color: #0d9df0;
}
.van-sidebar-item {
  background-color: #e5e5e5;
}
.van-sidebar-item--select, .van-sidebar-item--select:active{
  background-color: #fff;
}
.itemdisease{
  font-size: 16px;
  border-bottom: solid 1px #9fd8f9;
  padding: 10px 8px;
  color:#000000;
  .name{
    font-weight: bold;
  }
  .scalias{
    span{
      color: #999999;
    }
  }
  .typicalSymptom{
    color: #999999;
  }
}
</style>